<route>
    {
        meta: {
            layout: 'index',
            title:'工作量管理'
        }
    }  
</route>
<template>
    <!-- <a-card  style="width: 1050px; " :bordered="false"> -->
    <view style="width: 1000px; ">
        <a-form :model="formState" :labelCol="{ span: 6 }" name="basic" autocomplete="off">
            <a-row>
                <a-form-item label="岗位名称" name="jobName" style="width:500px">
                    <a-input :disabled="true" :min="0" :step="0.1" style="width:300px" v-model:value="jobData.jobName" />
                </a-form-item>
                <a-form-item label="岗位等级" name="jobGrade" style="width:500px">
                    <a-input :disabled="true" :min="0" :step="0.1" style="width:300px" v-model:value="jobData.jobGrade" />
                </a-form-item></a-row>
            <a-row>
                <a-form-item label="岗位类型" name="jobType" style="width:500px">
                    <a-input :disabled="true" :min="0" :step="0.1" style="width:300px" v-model:value="jobData.jobType" />
                </a-form-item>
                <a-form-item label="岗位代码" name="jobCode" style="width:500px">
                    <a-input :disabled="true" :min="0" :step="0.1" style="width:300px" v-model:value="jobData.jobCode" />
                </a-form-item></a-row>
            <a-row>
                <a-form-item label="教学工作量要求" name="teachWorkload" style="width:500px"
                    :rules="[{ required: true, message: '请输入教学工作量要求' }]">
                    <a-input-number :min="0" :step="0.1" style="width:300px" v-model:value="formState.teachWorkload" />
                </a-form-item>
                <a-form-item label="科研工作量要求" name="researchWorkload" style="width:500px"
                    :rules="[{ required: true, message: '请输入科研工作量要求' }]">
                    <a-input-number :min="0" :step="0.1" style="width:300px" v-model:value="formState.researchWorkload" />
                </a-form-item></a-row>
            <a-row>
                <a-form-item label="管理工作量要求" name="manageWorkload" style="width:500px"
                    :rules="[{ required: true, message: '请输入管理工作量要求' }]">
                    <a-input-number :min="0" :step="0.1" style="width:300px" v-model:value="formState.manageWorkload" />
                </a-form-item>
                <a-form-item label="其他工作量要求" name="otherWorkload" style="width:500px"
                    :rules="[{ required: true, message: '请输入其他工作量要求' }]">
                    <a-input-number :min="0" :step="0.1" style="width:300px" v-model:value="formState.otherWorkload" />
                </a-form-item></a-row>
            <a-button key="submit" type="primary" style="margin-left: 86%;" @click="submit">提交</a-button>
        </a-form>
    </view>
    <!-- </a-card> -->
</template>
<script setup>
import { queryOne, updateExt } from "@/custom/nepu/api/nepu_job.js";

const jobData = ref({
    jobType: undefined,
    jobGrade: undefined,
    jobType: undefined,
    jobCode: undefined
})
const router = useRouter();
const formState = ref({
    teachWorkload: 0,
    researchWorkload: 0,
    manageWorkload: 0,
    otherWorkload: 0
});
// 获取岗位信息 
const { id } = router.currentRoute.value.params
function doQuery(id) {
    console.log(id)
    queryOne(id).then(res => {
        console.log(res)
        jobData.value = res;
        formState.value = JSON.parse(res.extParams)
    })
}
function submit() {
    formState.value.id = id
    updateExt(formState.value).then(res => {
        console.log(res)
    })
}
doQuery(id)
</script>